<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>创客英雄</title>
<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
<link href="__TMPL__Portal/assets/css/ckyx.css" rel="stylesheet">
<script src="__TMPL__Portal/assets/js/ckyx.min.js"></script>
<link href="__TMPL__Portal/assets/css/main.css" rel="stylesheet">
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.min.js"></script>
</head>

<body>
<!--header-->
<tc_include file="Portal:head" />
<div class="nav_box">
    <div class="container">
        <div class="row">
            <a class="logo col-md-2" href="../index.html">
                <img src="__TMPL__Portal/assets/images/logo.png">
            </a>
            <tc_include file="Portal:nav" />
        </div>
    </div>
</div>

<!--banner_2-->
<div class="container banner_2">
	<img src="__TMPL__Portal/assets/images/zsxc.png">
</div>

<!--main3-->
<div class="container main3_box">
	<div class="ysbkbt">
        <div>用户登录</div>
    </div>
	<div class="main1_left main3 main5">
		<div class="twbk">        	
			<div class="dlkj">
            	<div class="dlkjnr">
                    <form method="post" action="">
                        <div class="input-group youxiang">
                            <input id="email" type="text" class="form-control" placeholder="请输入邮箱">
                        </div>
                        <div class="input-group mima">
                            <input id="psw" type="text" class="form-control" placeholder="请输入密码">
                        </div>
                        <div class="btn-group denglu">
                            <button type="submit" class="btn btn-info dropdown-toggle">
                                登&nbsp;&nbsp;录
                            </button>
                        </div>
                    </form>
                    <a class="wjmm" href="{:U('Hacker/wjmm')}">忘记密码？</a>
                </div>
            </div>
        </div>
    </div>    
</div>

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
    $("form").submit(function(e){
        var psw = $.trim($("#psw").val());
        var email = $.trim($("#email").val());
        // 邮箱验证正则表达式
        var pattern = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        if(email == ""){
            layer.msg('请输入邮箱');
            return false;
        }else if(!pattern.test(email)){
            layer.msg('邮箱格式不正确');
            return false;
        }else if(psw == ""){
            layer.msg('请输入密码');
            return false;
        }
        psw = md5(psw);
        $.ajax({
            type: "POST",
            url: "{:U('Hacker/login')}",
            data: {user_email:email, psw:psw, user_type:2},
            success: function(result) {
                var result=eval("("+result+")");
                if(result.status){
                    layer.msg('登录成功',{time:500},function(){
                        location.href = "{:U('Index/index')}";
                    });
                }else{
                    layer.msg(result.message);
                }
            }
        });
        return false;
    });
</script>

<!--页脚-->
<tc_include file="Portal:footer" />

</body>
</html>
